var util = require('../../utils/util.js');
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    positionInfo: '',
    status: 0,
    recommendId: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    var jobId = options.jobId;
    var status = options.status;
    var recommendId = options.recommendId;
    that.setData({
      status: status,
      recommendId: recommendId
    })
    console.log(this.data.status)
    console.log("===============",status);
    util.post(app.api.getPositionDetail, { jobid: jobId},function(res){
    //获取职位详情
      that.setData({
        positionInfo: res.data,
      })
    });
    
  },

  agree: function(){
    var that = this;
    util.post(app.api.updateRecommendStatus,{
      status: 7,
      id: this.data.recommendId, 
      openid: app.globalData.openid, 
      unionid: app.globalData.unionid
    },function(res){
      that.setData({
        status : 7
      })
    })
  },
  deagree:function(){
    var that = this;
    util.post(app.api.updateRecommendStatus,{
      status: 8,
      id: this.data.recommendId,
      openid: app.globalData.openid, 
      unionid: app.globalData.unionid
    },function(res){
      that.setData({
        status : 8
      })
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})